<template>
  <div class="main-nav">
    <div class="nav-first" @mouseenter="isNavEnter = true" @mouseleave="isNavEnter = false">
      <ul>
        <li v-for="(item,index) in navFirst" :key="index"
            :class="{active: item.type === selected}"
            @mouseenter="selected = item.type">
          <p>
            <span>{{item.name}}</span>
            <span class="icon">></span>
          </p>
        </li>
      </ul>
    </div>
    <div class="nav-sec" v-show="isNavEnter || isMenuEnter"
        @mouseenter="isMenuEnter = true" @mouseleave="isMenuEnter = false">
      <ul v-for="(item,index) in navFirst" v-show="item.type === selected" :key="index">
        <li v-for="(key,index) in navSec[item.type]"  :key="index">
          <div class="product">
            <a :href="key.link">
<!--              <img :src="key.imgUrl" alt="">-->
              <p class="title">{{key.title}}</p>
            </a>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>

export default {
  data () {
    return {
      selected: '',
      isNavEnter: false,
      isMenuEnter: false,
      navFirst: [
        {name: '提前本科批次', type: 'phone'},
        {name: '普通本科批次', type: 'pad'},
        {name: '普通高职批次', type: 'tv'}
      ],
      navSec: {
        phone: [
          {title: '军队飞行员志愿', link: 'https://gaokao.chsi.com.cn/z/kjzf/'},
          {title: '民航飞行员志愿', link: 'https://zhuanlan.zhihu.com/p/265501827?ivk_sa=1024320u'},
          {title: '普通类提前本科批A阶段', link: 'http://www.gaosan.com/gaokao/367275.html'},
          {title: '普通类提前本科批B阶段', link: 'http://www.gaosan.com/gaokao/367275.html'},
          {title: '本科批', link: 'https://baike.baidu.com/item/普通高等学校招生全国统一考试招生录取批次/19892574?fromtitle=本科批次&fromid=5382670&fr=aladdin'},
          {title: '对口本科批', link: 'https://www.liuxue86.com/k_对口本科批一志愿投档分数线/'}
        ],
        pad: [
          {title: '高水平艺术团和高水平运动员', link: 'https://zhuanlan.zhihu.com/p/54520294?from=singlemessage'},
          {title: '普通类本科批A阶段', link: 'http://www.gaosan.com/gaokao/367275.html'},
          {title: '普通类本科批B阶段', link: 'http://www.gaosan.com/gaokao/367275.html'}
        ],
        tv: [
          {title: '普通类提前高职（专科）批次', link: 'https://baijiahao.baidu.com/s?id=1706675362359736733&wfr=spider&for=pc'},
          {title: '普通类高职（专科）批次', link: 'https://baijiahao.baidu.com/s?id=1706675362359736733&wfr=spider&for=pc'}
        ]
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.main-nav{
  font-size: 20px;
  width: 1226px;
  background: #fff;
  margin: 0 auto;
  position: relative;
  display: flex;
  justify-content: flex-start;
  >.nav-first{
    font-size: 24px;
    width: 235px;
  	height: 458px;
    position: relative;
    z-index: 5;
    ul{
      display: flex;
      justify-content: space-between;
      flex-direction: column;
      background: rgba(0,0,0,0.6);
      padding: 20px 0;
      color: #fff;
      li{
        padding-left: 30px;
        height: 140px;
        line-height: 42px;
        cursor: pointer;
        &:hover{
          background: #ff6700;
        }
        >p{
          display: flex;
          justify-content: space-between;
          >.icon{
            margin-right: 20px;
            font-weight: bold;
          }
        }
      }
    }
  }
  .nav-sec{
    height: 458px;
    width: 250px;
    position: absolute;
    top: 0;
    left: 235px;
    background: #fff;
    z-index: 5;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    border-left: none;
    box-shadow: 0 8px 16px rgba(0,0,0,0.18);
    ul{
      height: 458px;
      display: flex;
      flex-flow: wrap;
      flex-direction: column;
      align-items: flex-start;
      align-content: flex-start;
      justify-content: flex-start;
      li{
        width: 265px;
        height: 76px;
        .product{
          a{
            display: flex;
            justify-content: flex-start;
            align-items: center;
            transition: color .2s;
            width: 265px;
            padding: 20px 20px;
            &:hover{
              color: #ff6700;
            }
            //img{
            //  width: 40px;
            //  height: 40px;
            //  margin-right: 12px;
            //}
          }
        }
      }
    }
  }
}
</style>
